package br.edu.fa7.especializao.extremeprograming.tuita.util;

import java.sql.Connection;
import java.sql.SQLException;

import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.datasource.AbstractDataSource;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

public class SpringUtil {

	public static Connection getConnection(ApplicationContext applicationContext) throws SQLException {
		AbstractDataSource dataSource = (DriverManagerDataSource) applicationContext
				.getBean("datasource");
		return dataSource.getConnection();

	}
}